//
//  UIButton+Category.h
//  Yanwei
//
//  Created by 刘文 on 16/11/1.
//  Copyright © 2016年 DCloud. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, SFButtonEdgeInsetsStyle) {
    SFButtonEdgeInsetsStyleTop, // image在上，label在下
    SFButtonEdgeInsetsStyleLeft, // image在左，label在右
    SFButtonEdgeInsetsStyleBottom, // image在下，label在上
    SFButtonEdgeInsetsStyleRight // image在右，label在左
};

typedef void(^tapActionBlock)(UIButton *button);
typedef void(^StartWithTimeIsEndBlock)();

@interface UIButton (Category)

@property(nonatomic, copy)tapActionBlock actionBlock;

/**
 通过block对button的点击事件封装
 
 @param frame       frame
 @param title       标题
 @param bgImageName 背景图片
 @param actionBlock 点击事件回调block
 
 @return button
 */
+ (UIButton *)createBtnFrame:(CGRect)frame title:(NSString *)title nomalImageName:(NSString *)nomalImageName selectedImageName:(NSString *)selectedImageName highlightedImageName:(NSString *)highlightedImageName bgImageName:(NSString *)bgImageName action:(tapActionBlock)actionBlock;

/**
 *  设置button的titleLabel和imageView的布局样式，及间距
 *
 *  @param style titleLabel和imageView的布局样式
 *  @param space titleLabel和imageView的间距
 */
- (void)layoutButtonWithEdgeInsetsStyle:(SFButtonEdgeInsetsStyle)style
                        imageTitleSpace:(CGFloat)space;

/**
 *  倒计时按钮
 *
 *  @param timeLine 倒计时总时间
 *  @param title    还没倒计时的title
 *  @param beforeSubTitle 时间之前的描述
 *  @param subTitle 倒计时中的子名字，如时、分
 *  @param mColor   还没倒计时的颜色
 *  @param color    倒计时中的颜色
 *  @param isCerificationCode 是否为验证码
 */
- (void)startWithTime:(NSInteger)timeLine title:(NSString *)title beforeSubTitle:(NSString *)beforeSubTitle countDownTitle:(NSString *)subTitle mainColor:(UIColor *)mColor countColor:(UIColor *)color isCerificationCode:(BOOL)isCerificationCode startWithTimeIsEndBlock:(StartWithTimeIsEndBlock)startWithTimeIsEndBlock;

@end
